Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#6981: Normalized image profile path hash and added profile purging #8788

Merged
merged 10 commits into from
May 3, 2024

Conversation

BenedekFarkas
Copy link
Member

@BenedekFarkas BenedekFarkas commented Apr 17, 2024

Fixes #6981

Originally developed by @anoordende from @zumeymedia in #6984.

Original description

This resolves both issue #6981 by normalizing the profile path hash, as well as re-introduces an old CodePlex PR that missed the GitHub boat, namely the ability to purge profiles through the Admin UI.

Normalizing the image profile path

Normalizing the image profile path hash "should" be the default for all new sites, as it allows for changing the domain from which images are served, whilst maintaining the already generated profiles. This enables, for example, 301 SEO-friendly redirects when moving from local storage to azure storage or moving to a CDN by simply redirecting one-to-one at the ^_Profiles/.* level.

Important for Release Notes
Existing sites may opt-out from Normalizing the profile paths, especially those which are not serving from the local Media folder, those which use a container other than "media" in Azure Blob Storage and those sites which use a custom storage provider. This can be achieved by setting the following AppSetting to false, which sets the behavior exactly as before:

<add key="Orchard.MediaProcessing.NormalizePath" value="false" />

Purging Profiles

As mentioned, this PR also enables 2 purge options form the Admin > Media > Profiles view, forcing profiles to be regenerated and old "orphaned" images will be cleared:

  1. Purge all images under an individual profile
  2. Purge all obsolete images, including all dynamic profiles (such as the Admin UI thumbs)

This functionality sits quite naturally with the normalization of the hashes, as those who wish to implement the normalization on existing sites immediately have a function to clear the old profiles (using the Purge Obsolete option). Though for SEO purposes you probably want to wait a few months before doing so.


Additional changes

  • Deleting a Profile also removes its generated files.
  • I removed the "Normalizing the image profile path" feature, because I couldn't reliably test it and what I could test did not work. Probably due to incompatibility with changes implemented since this PRs original development. I would opt to the merge the rest of this PR (Purging Profiles), which is a useful and fully working functionality. "Normalizing the image profile path" is interesting in when you migrate a Production site from local (file system) Media storage to Azure Blob Storage and want to keep the images generated by image profiles, but at this point IMO we can live without that.

src/Orchard.Web/Modules/Orchard.MediaProcessing/Services/ImageProfileManager.cs has been reset to dev due the large amount of merge conflicts
@BenedekFarkas BenedekFarkas marked this pull request as draft April 17, 2024 15:27
@BenedekFarkas BenedekFarkas changed the title 6981: Normalized image profile path hash and added profile purging #6981: Normalized image profile path hash and added profile purging Apr 18, 2024
@BenedekFarkas BenedekFarkas marked this pull request as ready for review April 19, 2024 16:22
@BenedekFarkas BenedekFarkas merged commit 62038ed into OrchardCMS:dev May 3, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ImageProfile paths need to exclude host to allow 301 redirects on domain moves
3 participants